package com.kun.order.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import com.kun.order.vo.OrderDetailedVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kun.order.entity.OrderDetailedEntity;
import com.kun.order.service.OrderDetailedService;
import com.kun.common.utils.PageUtils;
import com.kun.common.utils.R;



/**
 * 
 *
 * @author kun_er
 * @email 2661038743@qq.com
 * @date 2022-05-02 16:08:08
 */
@RestController
@RequestMapping("order/orderdetailed")
public class OrderDetailedController {
    @Autowired
    private OrderDetailedService orderDetailedService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderDetailedService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		List<OrderDetailedVo> orderDetailed = orderDetailedService.getOrderDestailByOederId(id);

        return R.ok().put("orderDetailed", orderDetailed);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OrderDetailedEntity orderDetailed){
		orderDetailedService.addOrderDetailed(orderDetailed);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrderDetailedEntity orderDetailed){
		orderDetailedService.updateDetailed(orderDetailed);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestParam String id){
		orderDetailedService.removeById(id);

        return R.ok();
    }

}
